﻿using Bmz.IM.AccessDB;
using Bmz.IM.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bmz.IM.Communication
{
    public class FriendInfo
    {
        FriendAccess friendAc = new FriendAccess();
        public List<FriendVO> GetFriends(string userId)
        {
            List<FriendPO> friendPOList = friendAc.GetListByUserId(userId);
            List<FriendVO> friendVOList = new List<FriendVO>();
            UserAccess userAccess = new UserAccess();
            foreach (FriendPO item in friendPOList)
            {
                UserPO user = userAccess.GetUserModelByUserId(item.FriendId);
                friendVOList.Add(new FriendVO()
                {
                    UserId = user.UserId,
                    UserName = user.UserName,
                    Folder = item.Folder,
                    Ip = user.Ip,
                    Port = user.Port,
                    CurrentState = user.CurrentState,
                    TodayFeeling = user.TodayFeeling,
                    RecentLoginDate = user.RecentLoginDate,
                    UserRemark = user.Remark,
                });
            }
            return friendVOList;
        }
    }
}
